package game.roles.visual;

import game.frame.MainFrame;
import game.roles.Role;
import game.utils.ImageChange;

import java.awt.*;

/**
 * @author liuyulai
 * Created with IntelliJ IDEA.
 * Date: 21.5.8
 * Time: 9:27
 * Description: 爆炸效果
 */
public class Boom extends Role {
    /**
     * 爆炸效果
     */
    public static Image[] boomImages;

    /**
     * 图片切换
     */
    private ImageChange imageChange = new ImageChange(1);

    /**
     * 爆炸计数器
     */
    private int count;

    public Boom(int x, int y) {
        super(x, y, 100, 100);
    }

    @Override
    public void rolesMove() {
        count++;
        this.img = imageChange.change(boomImages);
        //如果大于100则在集合中移除爆炸效果
        if (this.count > 25) {
            MainFrame.roleList.remove(this);
            count = 0;
        }
    }
}
